package io.gitee.zhangbinhub.acp.boot.listener

import io.gitee.zhangbinhub.acp.boot.init.AcpInitialization
import io.gitee.zhangbinhub.acp.boot.log.LogAdapter
import org.noear.solon.core.event.AppLoadEndEvent
import org.noear.solon.core.event.EventListener

/**
 * @since JDK 17
 */
class AcpApplicationStartupListener(
    private val logAdapter: LogAdapter,
    private val initializationList: List<AcpInitialization>
) : EventListener<AppLoadEndEvent> {

    override fun onEvent(event: AppLoadEndEvent?) {
        initializationList.forEach { initialization ->
            logAdapter.info("start system initialization: " + initialization.name)
            initialization.doInit()
        }
    }
}
